package network;

import android.content.Context;

import com.google.gson.Gson;
import com.loopj.android.http.BinaryHttpResponseHandler;
import com.loopj.android.http.RequestParams;

import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;

import GsonBean.AddJclrxxListBean;
import GsonBean.AddPointBean;
import GsonBean.CheckInfoBean;
import GsonBean.CheckPersonBean;
import GsonBean.CheckPlanBean;
import GsonBean.ContactBean;
import GsonBean.IsLogin;
import GsonBean.JcxxChakanBean;
import GsonBean.JdjcdclBean;
import GsonBean.JdjclrBean;
import GsonBean.JdjclrxqBean;
import GsonBean.JhshBean;
import GsonBean.JhshLsBean;
import GsonBean.MyYdjdjhbInfo;
import GsonBean.NewAppBean;
import GsonBean.ProtectMeasuresBean;
import GsonBean.RjhsgxmList;
import GsonBean.SafetyBean;
import GsonBean.SecurityRiskBean;
import GsonBean.SgcxrjhBean;
import GsonBean.SgcxrjhDetailBean;
import GsonBean.SgcxzjhBean;
import GsonBean.SgcxzjhDetailBean;
import GsonBean.SgqdBean;
import GsonBean.SgrjhCkshjlBean;
import GsonBean.SgrjhShListBean;
import GsonBean.SgrjhShywcListBean;
import GsonBean.SgzjhCkshjlBean;
import GsonBean.ShenheInfoBean;
import GsonBean.ShyjhxqBean;
import GsonBean.ShzjhBean;
import GsonBean.ShzjhywcBean;
import GsonBean.SuccessBean;
import GsonBean.UniteInfomationBean;
import GsonBean.UserBean;
import GsonBean.YjhshthBean;
import GsonBean.ZbyjhBean;
import GsonBean.ZsjhChangeBean;
import GsonBean.ZsrjhBean;
import GsonBean.ZsyjhBean;
import GsonBean.ZsyjhxxBean;
import GsonBean.ZszjhBean;
import GsonBean.ZszjhxxBean;
import GsonBean.post.AddPointPost;
import GsonBean.post.CheckPersonPost;
import GsonBean.post.IsShutDownAuditPost;
import GsonBean.post.LjyyxRjdjhbShdw;
import GsonBean.post.MySgbOpeartion;
import GsonBean.post.MySgbOpeartionZd;
import GsonBean.post.MyZjdjhbShdw;
import GsonBean.post.QdzgrPost;
import GsonBean.post.SaveCaoGaoPost;
import GsonBean.post.SgbDhzPost;
import GsonBean.post.SgbThPost;
import GsonBean.post.SgbhzPost;
import GsonBean.post.SgyjhshPost;
import GsonBean.post.ShPost;
import GsonBean.post.ShcfPost;
import GsonBean.post.TgysPost;
import GsonBean.post.TjjdjcdPost;
import GsonBean.post.TxzgqkPost;
import GsonBean.post.XmzgbmTjPost;
import Utils.RetrofitUtils;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * Created by 任科全 on 2017/3/17.
 *
 * @function 接口地址
 */

public class NetWorkApi {


    public static Api api = RetrofitUtils.getInstance().create(Api.class);

    //登录
    public static void login(Map map, Callback<IsLogin> callback) {
        Call<IsLogin> request = api.login(map);
        request.enqueue(callback);
    }

    //获取监督检查列表的信息
    public static void getCheckListData(Map map, Callback<CheckPlanBean> callback) {
        Call<CheckPlanBean> requset = api.getCheckListData(map);
        requset.enqueue(callback);
    }


    //根据日计划号ID获取该计划的详细数据
    public static void getCheckInfoData(String bh, Callback<CheckInfoBean> callback) {

        Call<CheckInfoBean> requset = api.getCheckInfoData(bh);
        requset.enqueue(callback);
    }

    //根据登录单位ID获取相应单位所有的用户信息
    public static void getAllUserInfoByCompanyId(Map map, Callback<UserBean> callback) {
        Call<UserBean> requset = api.getAllUserInfoByCompanyId(map);
        requset.enqueue(callback);
    }


    //根据日计划号和登录单位ID获取该单位填报的施工监护人员（测试：jdjhbBh=LR00173 & lrdwId=102）
    public static void getSgjhry(Map map, Callback<CheckPersonBean> callback) {

        Call<CheckPersonBean> requset = api.getSgjhry(map);
        requset.enqueue(callback);
    }

    //保存编辑监护人信息
    public static void saveEditerPerson(List<CheckPersonPost> mlist, Callback<SuccessBean> callback) {

        Call<SuccessBean> requset = api.saveEditerPerson(mlist);
        requset.enqueue(callback);

    }

    //获取所有的安全风险字典表
    public static void getAllSecurityRisk(Callback<SecurityRiskBean> callback) {
        Call<SecurityRiskBean> requset = api.getAllSecurityRisk();
        requset.enqueue(callback);
    }


    //获取所有的安全风险防护措施字典表
    public static void getAllProtectMeasures(Callback<ProtectMeasuresBean> callback) {
        Call<ProtectMeasuresBean> requset = api.getAllProtectMeasures();
        requset.enqueue(callback);
    }


    //根据日计划号和登录单位ID获取该单位填报的已有风险点与补充风险点（日计划号：jdjhbBh=LR00173 &登录单位ID lrdwId=102）
    public static void getBcfxd(Map<String, String> map, Callback<AddPointBean> callback) {
        Call<AddPointBean> requset = api.getBcfxd(map);
        requset.enqueue(callback);
    }

    //补充安全风险 日计划号	jdjhbBh 安全风险内容	aqfxnr 安全风险措施内容	aqfxcsnr 录入用户名	lrrId 录入单位ID	lrdwId
    public static void UpdataBcaqfx(List<AddPointPost> mList, Callback<AddPointPost> callback) {
        Call<AddPointPost> requset = api.UpdataBcaqfx(mList);
        requset.enqueue(callback);
    }


    //获取监督检查录入列表数据
    public static void getCustodyData(Map<String, String> map, Callback<JdjclrBean> callback) {
        Call<JdjclrBean> requset = api.getCustodyData(map);
        requset.enqueue(callback);
    }

    //获取监督检查待处理列表数据
    public static void getCustodyDclData(Map<String, String> map, Callback<JdjcdclBean> callback) {
        Call<JdjcdclBean> requset = api.getCustodyDclData(map);
        requset.enqueue(callback);
    }

    //获取监督检查已处理列表数据
    public static void getCustodyYclData(Map<String, String> map, Callback<JdjcdclBean> callback) {
        Call<JdjcdclBean> requset = api.getCustodyYclData(map);
        requset.enqueue(callback);
    }


    //监督检查计划详情 编辑监督检查计划
    public static void getJdjcjhInfo(Map<String, String> map, Callback<JdjclrxqBean> callback) {
        Call<JdjclrxqBean> requset = api.getJdjcjhInfo(map);
        requset.enqueue(callback);
    }

    //监督计划 新增时，保存草稿  打开草稿时，保存草稿     保存草稿接口
    public static void SaveCaoGao(SaveCaoGaoPost bean, Callback<SuccessBean> callback) {
        Call<SuccessBean> requset = api.SaveCaoGao(bean);
        requset.enqueue(callback);
    }

    //删除草稿
    public static void sccg(Map<String, String> map, Callback<SuccessBean> callback) {
        Call<SuccessBean> requset = api.sccg(map);
        requset.enqueue(callback);

    }

    //根据日期获取监督检查录入信息 新增界面 的ListView信息
    public static void getZsrjhtxjdjcListDate(Map<String, String> map, Callback<AddJclrxxListBean> callback) {
        Call<AddJclrxxListBean> requset = api.getZsrjhtxjdjcListDate(map);
        requset.enqueue(callback);
    }

    //根据日计划号获取日施工项目集合
    public static void getRjhSgxmList(Map<String, String> map, Callback<RjhsgxmList> callback) {
        Call<RjhsgxmList> requset = api.getRjhSgxmList(map);
        requset.enqueue(callback);
    }

    //检查完成按钮，直接完成检查
    public static void Zgtj( SaveCaoGaoPost mBean, Callback<SuccessBean> callback) {
        Call<SuccessBean> requset = api.Zgtj(mBean);
        requset.enqueue(callback);
    }

    //检查完成按钮，直接完成检查
    public static void tjwc(SaveCaoGaoPost mBean, Callback<SuccessBean> callback) {
        Call<SuccessBean> requset = api.tjwc(mBean);
        requset.enqueue(callback);
    }

    //监督检查详情查看页 数据获取
    public static void getJcxxChakanList(Map<String, String> map, BaseCallBack<JcxxChakanBean> callback) {

        Call<JcxxChakanBean> requset = api.getJcxxChakanList(map);
        requset.enqueue(callback);

    }

    //【停工审核】--【确认】接口方法
    public static void TgShqr(IsShutDownAuditPost bean,Callback<SuccessBean> callback) {

        Call<SuccessBean> requset = api.TgShqr(bean);
        requset.enqueue(callback);
    }

    //选择整改人【确认】接口方法
    public static void Qdzgr(QdzgrPost bean,Callback<SuccessBean> callback) {

        Call<SuccessBean> requset = api.Qdzgr(bean);
        requset.enqueue(callback);
    }

    //信息员【提交】--【确认】接口方法
    public static void Tjjdjcd(TjjdjcdPost bean,Callback<SuccessBean> callback) {

        Call<SuccessBean> requset = api.Tjjdjcd(bean);
        requset.enqueue(callback);
    }

    //整改人【填写整改情况】---【确认】接口方法
    public static void Txzgqk(TxzgqkPost bean,Callback<SuccessBean> callback) {

        Call<SuccessBean> requset = api.Txzgqk(bean);
        requset.enqueue(callback);
    }

    //发出人【审核】--【确认】接口方法
    public static void Sh(ShPost bean,Callback<SuccessBean> callback) {

        Call<SuccessBean> requset = api.Sh(bean);
        requset.enqueue(callback);
    }

    //整改人【收回重发】--【确认】接口方法
    public static void shcf(ShcfPost bean,Callback<SuccessBean> callback) {
        Call<SuccessBean> requset = api.shcf(bean);
        requset.enqueue(callback);
    }

    //更新所有的单位字典表信息（单位信息数据：只显示顶级单位名称）
    public static void getAllUniteInfomation(Callback<UniteInfomationBean> callback) {
        Call<UniteInfomationBean> requset = api.getAllUniteInfomation();
        requset.enqueue(callback);
    }


    //对比本地APP与服务器APP版本
    public static void getApp(Callback<NewAppBean> callback) {
        Call<NewAppBean> requset = api.getApp();
        requset.enqueue(callback);
    }

    //下载APP
    public static void downLoadApp(Context context, BinaryHttpResponseHandler mBinaryHttpResponseHandler) {
        String url = "https://www.st12306.cn/app-ljyyx/upload/apk/app-ljyyx.apk";
        NetWork.postNoAbsoluterUrl(context, url, null, mBinaryHttpResponseHandler);
    }

    //下载施工安全问题分类字典表
    public static void getAllSafety(Callback<SafetyBean> callback) {
        Call<SafetyBean> requset = api.getAllSafety();
        requset.enqueue(callback);
    }

    //停工预审
    public static void Tgys(TgysPost bean, Callback<SuccessBean> callback) {

        Call<SuccessBean> requset = api.Tgys(bean);
        requset.enqueue(callback);
    }

    //复工预审
    public static void Fgys( TgysPost bean,Callback<SuccessBean> callback) {

        Call<SuccessBean> requset = api.Fgys(bean);
        requset.enqueue(callback);
    }

    //复工审核
    public static void Fgsh(TgysPost bean,Callback<SuccessBean> callback) {
        Call<SuccessBean> requset = api.Fgsh(bean);
        requset.enqueue(callback);
    }

    //整改审核
    public static void Zgsh( TgysPost bean, Callback<SuccessBean> callback) {
        Call<SuccessBean> requset = api.Zgsh(bean);
        requset.enqueue(callback);
    }

    //获取正式日计划列表数据
    public static void getZsrjhList(Map<String,String> map, Callback<ZsrjhBean> callback) {
        Call<ZsrjhBean> requset = api.getZsrjhList(map);
        requset.enqueue(callback);
    }

    //获取正式周计划列表数据
    public static void getZszjhList(Map<String,String> map, Callback<ZszjhBean> callback) {
        Call<ZszjhBean> requset = api.getZszjhList(map);
        requset.enqueue(callback);
    }

    //获取增补月计划列表数据
    public static void getZbyjhList(Map<String,String> map, Callback<ZbyjhBean> callback) {
        Call<ZbyjhBean> requset = api.getZbyjhList(map);
        requset.enqueue(callback);
    }

    //获取正式月计划列表数据
    public static void getZsyjhList(Map<String,String> map, Callback<ZsyjhBean> callback) {
        Call<ZsyjhBean> requset = api.getZsyjhList(map);
        requset.enqueue(callback);
    }

    //作废正式日计划
    public static void changeZsrjh(ZsjhChangeBean bean,Callback<SuccessBean> callback) {
        Call<SuccessBean> requset = api.changeZsrjh(bean);
        requset.enqueue(callback);
    }

    //根据月计划号查询该月计划详情
    public static void getZsyjhXx(Map<String,String> map, Callback<ShyjhxqBean> callback) {
        Call<ShyjhxqBean> requset = api.getZsyjhXx(map);
        requset.enqueue(callback);
    }


    //根据周计划号查询该周计划详情
    public static void getZszjhXx(Map<String,String> map, Callback<ZszjhxxBean> callback) {
        Call<ZszjhxxBean> requset = api.getZszjhXx(map);
        requset.enqueue(callback);
    }

    //获取审核月计划列表数据
    public static void getSheyjh(Map<String,String> map, Callback<JhshBean> callback) {
        Call<JhshBean> requset = api.getSheyjh(map);
        requset.enqueue(callback);
    }

    //获取审核月查询计划列表数据
    public static void getSheyjhcx(Map<String,String> map, Callback<JhshBean> callback) {
        Call<JhshBean> requset = api.getSheyjhcx(map);
        requset.enqueue(callback);
    }

    //根据月计划号查询该月计划历史详情
    public static void getJhshLsXq(Map<String,String> map, Callback<JhshLsBean> callback) {
        Call<JhshLsBean> requset = api.getJhshLsXq(map);
        requset.enqueue(callback);
    }

    //获取施工月计划审核记录
    public static void getSgyjhshjl(Map<String,String> map, Callback<ShenheInfoBean> callback) {
        Call<ShenheInfoBean> requset = api.getSgyjhshjl(map);
        requset.enqueue(callback);
    }

    //获取单位联系人数据
    public static void getDwContact(Map<String,String> map, Callback<ContactBean> callback) {
        Call<ContactBean> requset = api.getDwContact(map);
        requset.enqueue(callback);
    }

    //获取施工日计划列表数据
    public static void getChaxunrjhData(Map<String,String> map, Callback<SgcxrjhBean> callback) {
        Call<SgcxrjhBean> requset = api.getChaxunrjhData(map);
        requset.enqueue(callback);
    }

    //获取施工日计划详情页数据
    public static void getChaxunrjhDetailData(Map<String,String> map, Callback<SgcxrjhDetailBean> callback) {
        Call<SgcxrjhDetailBean> requset = api.getChaxunrjhDetailData(map);
        requset.enqueue(callback);
    }

    //获取施工周计划列表数据
    public static void getSgzjhListData(Map<String,String> map, Callback<SgcxzjhBean> callback) {
        Call<SgcxzjhBean> requset = api.getSgzjhListData(map);
        requset.enqueue(callback);
    }

    //获取施工周计划详情页数据
    public static void getSgzjhDetailData(Map<String,String> map, Callback<SgcxzjhDetailBean> callback) {
        Call<SgcxzjhDetailBean> requset = api.getSgzjhDetailData(map);
        requset.enqueue(callback);
    }

    //获取审核月计划详情页数据
    public static void getShyjhDetailData(Map<String,String> map, Callback<ShyjhxqBean> callback) {
        Call<ShyjhxqBean> requset = api.getShyjhDetailData(map);
        requset.enqueue(callback);
    }

    //获取审批月计划详情页数据
    public static void getSpyjhDetailData(Map<String,String> map, Callback<JhshBean> callback) {
        Call<JhshBean> requset = api.getSpyjhDetailData(map);
        requset.enqueue(callback);
    }

    //审核月计划-审核页面【审核】确认
    public static void shyjh(SgyjhshPost bean,  Callback<SuccessBean> callback) {
        Call<SuccessBean> requset = api.shyjh(bean);
        requset.enqueue(callback);
    }

    //项目主管部门审核页面-【退回】确认
    public static void shyjhth(YjhshthBean bean,  Callback<SuccessBean> callback) {
        Call<SuccessBean> requset = api.shyjhth(bean);
        requset.enqueue(callback);
    }

    //项目主管部门审核页面-提交
    public static void shyjhtj( XmzgbmTjPost bean,  Callback<SuccessBean> callback) {
        Call<SuccessBean> requset = api.shyjhtj(bean);
        requset.enqueue(callback);
    }

    //Post提交设置流程页面的数据
    public static void postSetFlowData( GsonBean.post.MyYdjdjhbInfo bean,  Callback<SuccessBean> callback) {
        Call<SuccessBean> requset = api.postSetFlowData(bean);
        requset.enqueue(callback);
    }

    //审核月计划-施工办 汇总
    public static void sgbhz(SgbhzPost bean,  Callback<SuccessBean> callback) {
        Call<SuccessBean> requset = api.sgbhz(bean);
        requset.enqueue(callback);
    }

    //审核月计划-施工办 待汇总
    public static void sgbdhz(SgbDhzPost bean,  Callback<SuccessBean> callback) {
        Call<SuccessBean> requset = api.sgbdhz(bean);
        requset.enqueue(callback);
    }

    //审核月计划-施工办-【退回】确认
    public static void sgbth(SgbThPost bean,  Callback<SuccessBean> callback) {
        Call<SuccessBean> requset = api.sgbth(bean);
        requset.enqueue(callback);
    }

    //获取施工区段选择区段时的数据列表接口
    public static void getSgqdListData(Callback<SgqdBean> callback) {
        Call<SgqdBean> requset = api.getSgqdListData();
        requset.enqueue(callback);
    }

    //Post提交切换区段部分的数据
    public static void postQhqdData( MySgbOpeartion bean, Callback<SuccessBean> callback) {
        Call<SuccessBean> requset = api.postQhqdData(bean);
        requset.enqueue(callback);
    }

    //施工月计划审核已完成列表
    public static void getSgyjhShywcList(Map<String,String> map, Callback<JhshBean> callback) {
        Call<JhshBean> requset = api.getSgyjhShywcList(map);
        requset.enqueue(callback);
    }

    //Post提交施工办设置流程的数据
    public static void postSgbSetFlowData( MySgbOpeartionZd info, Callback<SuccessBean> callback) {
        Call<SuccessBean> requset = api.postSgbSetFlowData(info);
        requset.enqueue(callback);
    }

    //审核周计划菜单，列表查询接口
    public static void requestShzjhListData(Map<String,String> map, Callback<ShzjhBean> callback) {
        Call<ShzjhBean> requset = api.requestShzjhListData(map);
        requset.enqueue(callback);
    }

    //审核周计划之审核已完成列表数据接口
    public static void requestShzjhywcListData(Map<String,String> map, Callback<ShzjhywcBean> callback) {
        Call<ShzjhywcBean> requset = api.requestShzjhywcListData(map);
        requset.enqueue(callback);
    }

    //施工周计划查看审核记录数据接口
    public static void requestSgzjhCkshjlData(Map<String,String> map, Callback<SgzjhCkshjlBean> callback) {
        Call<SgzjhCkshjlBean> requset = api.requestSgzjhCkshjlData(map);
        requset.enqueue(callback);
    }

    //施工日计划之审核日计划列表数据接口
    public static void requestSgrjhShListData(Map<String,String> map, Callback<SgrjhShListBean> callback) {
        Call<SgrjhShListBean> requset = api.requestSgrjhShListData(map);
        requset.enqueue(callback);
    }

    //施工日计划之审核已完成列表数据接口
    public static void requestSgrjhShywcListData(Map<String,String> map, Callback<SgrjhShywcListBean> callback) {
        Call<SgrjhShywcListBean> requset = api.requestSgrjhShywcListData(map);
        requset.enqueue(callback);
    }

    //施工周计划之审核功能
    public static void postSgzjhShenheData(MyZjdjhbShdw bean, Callback<SuccessBean> callback) {
        Call<SuccessBean> requset = api.postSgzjhShenheData(bean);
        requset.enqueue(callback);
    }

    //施工周计划之审核已完成中的作废功能
    public static void requestSgzjhywcZfData(Map<String,String> map, Callback<SuccessBean> callback) {
        Call<SuccessBean> requset = api.requestSgzjhywcZfData(map);
        requset.enqueue(callback);
    }

    //施工周计划之审核已完成中的下达周计划功能
    public static void requestSgzjhywcXdzjh(Map<String,String> map, Callback<SuccessBean> callback) {
        Call<SuccessBean> requset = api.requestSgzjhywcXdzjh(map);
        requset.enqueue(callback);
    }

    //施工日计划之审核功能
    public static void postSgrjhShenheData( LjyyxRjdjhbShdw info,  Callback<SuccessBean> callback) {
        Call<SuccessBean> requset = api.postSgrjhShenheData(info);
        requset.enqueue(callback);
    }

    //施工日计划中查看审核记录数据
    public static void requestSgrjhCkshjlData(Map<String,String> map, Callback<SgrjhCkshjlBean> callback) {
        Call<SgrjhCkshjlBean> requset = api.requestSgrjhCkshjlData(map);
        requset.enqueue(callback);
    }

    //施工日计划之审核已完成中的作废功能
    public static void requestSgrjhywcZfData(Map<String,String> map, Callback<SuccessBean> callback) {
        Call<SuccessBean> requset = api.requestSgrjhywcZfData(map);
        requset.enqueue(callback);
    }

    //施工办审批已完成下达正式、下达增补接口
    public static void postSgbxdzs(GsonBean.MyYdjdjhbInfo bean, Callback<SuccessBean> callback) {
        Call<SuccessBean> requset = api.postSgbxdzs(bean);
        requset.enqueue(callback);
    }

}
